<?php

$i=0;$j=0;?>
<?php foreach ($categories as $key=>$value):?>

<?php if ($value['depth']==1):?>
<?php $i++;
$class='women';
if ($i%2==0)
{
	$class='men';
}
?>
<div class="<?php echo $class;?>">
<div class="title">
 <a href="<?php echo Configure::read('base_url');?>products/browsebycategory/<?php echo $value['id'];?>" class="lnk" >
<?php echo $value['category_name']; ?></a></div>
<div class="bodywrapper">
<?php endif;?>
<?php if ($value['depth']!=1):
$margin=$value['depth']*2*10;
$arrow='&gt;&nbsp;';
if ($value['depth']==2)
{
	$margin=0;
	$arrow='&gt;&gt;&nbsp;';
}

?>
<p style="margin-left:<?php echo $margin;?>px"><?php echo $arrow.' ';?>
 <a href="<?php echo Configure::read('base_url');?>products/browsebycategory/<?php echo $value['id'];?>">
<?php echo $value['category_name']; ?></a>
</p>
<?php endif;?>
<?php 
if ($key == count($categories)):?>
<div class="clear"></div>
</div>
</div>
<?php break; endif;?>
<?php 
if ($categories[$key+1]['depth']==1):?>
<div class="clear"></div>
</div>
</div>
<?php endif;?>
<?php //endif;?>
<?php endforeach;?>